package com.xiyou.luckdraw.api.dto.answer;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.xiyou.luckdraw.common.constants.ResultCodeConstants;
import com.xiyou.luckdraw.common.exception.ValidateException;
import com.xiyou.luckdraw.common.result.AbstractRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * @ClassName: DeleteAnswerBankRequest
 * @Description:
 * @author: limingxing
 * @Date: 2019-10-09 19:31
 */
@Data
@ApiModel("更新答题请求参数")
public class UpdateAnswerRequest extends AbstractRequest {

    private Integer answerId;
    @ApiModelProperty(value="题目")
    private String answerTitle;

    @ApiModelProperty(value="答案:A")
    @JsonProperty(value = "A")
    private String A;

    @ApiModelProperty(value="答案:B")
    @JsonProperty(value = "B")
    private String B;

    @ApiModelProperty(value="答案:C")
    @JsonProperty(value = "C")
    private String C;

    @ApiModelProperty(value="答案:D")
    @JsonProperty(value = "D")
    private String D;

    @ApiModelProperty(value="答案:E")
    @JsonProperty(value = "E")
    private String E;

    @ApiModelProperty(value="正确答案(当前只支持单选)")
    private Long correctAnswer;

    @ApiModelProperty(value="0：默认 1:启用,2：弃用")
    private Long status;
    @ApiModelProperty(value="用户id")
    private Long userId;

    @ApiModelProperty(value="更新时间")
    private Date modifyTime;

    @ApiModelProperty(value="答题等级 0：默认,1:难,2...")
    private Long level;
    @Override
    public void requestCheck() {
        if (null == answerId || null == status) {
            throw new ValidateException(ResultCodeConstants.REQUISITE_PARAMETER_NOT_EXIST.getCode(), ResultCodeConstants.REQUISITE_PARAMETER_NOT_EXIST.getMessage());
        }
    }
}
